package com.ad.pet.app.serach.adapter;

import android.app.Activity;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ad.pet.App;
import com.ad.pet.MainActivity;
import com.ad.pet.R;
import com.ad.pet.app.Navigation;
import com.ad.pet.common.data.utils.SpUtil;
import com.ad.pet.common.data.utils.glide.GlideUtil;
import com.ad.pet.constant.Constant;
import com.ad.pet.models.remote.home.HomeMall;

import java.util.List;

/**
 * Created by SEELE on 2019/5/21.
 */

public class SearchListEndGoodAdpater extends BaseQuickAdapter<HomeMall,BaseViewHolder> {
    public SearchListEndGoodAdpater( @Nullable List<HomeMall> data) {
        super(R.layout.item_good_search_list_layout, data);
    }

    @Override
    protected void convert(BaseViewHolder helper,final HomeMall item) {
        helper.setText(R.id.tv_title, item.getSales() + " " + App.getApp().getString(R.string.has_buy)).
                setText(R.id.tv_price, SpUtil.getInstance().getString(Constant.CURRENCY_LABEL,"US $") + item.getPrice());
        final ImageView view = helper.getView(R.id.iv_pic);


        GlideUtil.load(mContext, item.getImage(), view);



        helper.getView(R.id.linear_out).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Navigation.goGoodDetail((Activity) mContext, MainActivity.REQUEST_GO_MALL,item.getProduct_id());
            }
        });
    }
}
